package utility

import (
	"strconv"
	"time"
)

func GoStdTime() string {
	return "2006-01-02 15:04:05"
}

func GoStdUnixDate() string {
	return "Mon Jan _2 15:04:05 MST 2006"
}

func GoStdRubyDate() string {
	return "Mon Jan 02 15:04:05 -0700 2006"
}

func GetDateUnix(t time.Time) string {
	y, m, d := t.Date()
	return strconv.FormatInt(time.Date(y, m, d, 0, 0, 0, 0, time.Local).Unix(), 10)
}
func GetDateMaxUnix(t time.Time) string {
	y, m, d := t.Date()
	return strconv.FormatInt(time.Date(y, m, d, 23, 59, 59, 0, time.Local).Unix(), 10)
}
func GetDateMinUnix(t time.Time) string {
	y, m, d := t.Date()
	return strconv.FormatInt(time.Date(y, m, d, 0, 0, 0, 0, time.Local).Unix(), 10)
}
func GetPreDayMaxUnix() string {
	t := time.Now().AddDate(0, 0, -1)
	y, m, d := t.Date()
	return strconv.FormatInt(time.Date(y, m, d, 23, 59, 59, 0, time.Local).Unix(), 10)
}
func GetPreDayMinUnix() string {
	t := time.Now().AddDate(0, 0, -1)
	y, m, d := t.Date()
	return strconv.FormatInt(time.Date(y, m, d, 0, 0, 0, 0, time.Local).Unix(), 10)
}

func GetNowDate() string {
	t := time.Now()
	return t.Format("2006-01-02")
}
func GetPreDate() string {
	t := time.Now().AddDate(0, 0, -1)
	return t.Format("2006-01-02")
}

func GetDate(t time.Time) string {
	return t.Format("2006-01-02")
}

func GetNowTime() string {
	t := time.Now()
	return t.Format("2006-01-02 15:04:05")
}

func GetDiyFormatNowHour() string {
	t := time.Now()
	return t.Format("2006010215")
}
